﻿package mortal.game.view.copy.ZZXYBattle
{
    import extend.language.*;
    import flash.events.*;
    import mortal.game.events.*;
    import mortal.game.manager.*;
    import mortal.game.manager.msgTip.*;
    import mortal.game.mvc.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;
    import mortal.mvc.core.*;

    public class ZZXYBattleIcon extends ActionBaseIcon
    {
        private static var _instance:ZZXYBattleIcon;

        public function ZZXYBattleIcon()
        {
            super(ResFileConst.ZZXYBattleIcon);
            this.name = "TowerCopyIcon";
            return;
        }// end function

        override public function setLeftTimeAndState(param1:int, param2:int = 1, param3:String = "mm:ss", param4:Boolean = true) : void
        {
            super.setLeftTimeAndState(param1, param2);
            if (_state == ActionBaseIcon.State_Opening)
            {
                playEffect();
            }
            else
            {
                stopEffect();
            }
            return;
        }// end function

        override protected function timeOutCaller() : void
        {
            if (_state == ActionBaseIcon.State_ToBeOpen)
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.ZZXYBattleShowModule, true));
            }
            if (_state == ActionBaseIcon.State_Opening)
            {
                this.hide();
            }
            return;
        }// end function

        override protected function clickHandler(event:MouseEvent) : void
        {
            if (_state == ActionBaseIcon.State_ToBeOpen)
            {
                MsgManager.showRollTipsMsg(Language.getStringByParam(20979, currentTimeStr), MsgRollTipsType.msgRollTips3);
                return;
            }
            Dispatcher.dispatchEvent(new DataEvent(EventName.ZZXYBattleShowModule, true));
            return;
        }// end function

        public static function get instance() : ZZXYBattleIcon
        {
            if (!_instance)
            {
                _instance = new ZZXYBattleIcon;
            }
            return _instance;
        }// end function

        public static function hasInstance() : Boolean
        {
            return _instance != null;
        }// end function

    }
}
